{
  Copyright 2012, Jameel Halabi

  This unit is part of the BlaiseWave wrapper,
  which is licensed under the BSD 2-Clause license (see licenses/license.txt).
}

unit BW_Dyna;

{$mode objfpc}{$H+}

interface

uses
  LW_Dyna   ,
  LW_XPanel ,

  BW_Global ;

type

  { TDynaReqFuncs }

  TDynaReqFuncs = class(TGlobal)
  protected
    function GetGlobalType                   : String; override;
  public
    function  Create
               (const Title      : PChar            ) : PDynaRequest;
    function  AddCtrl
               (      Req        : PDynaRequest     ;
                const Label_     : PChar            ;
                      Descriptor : PDyReqControlDesc) : Integer     ;
    function  CtrlType
               (      Req        : PDynaRequest     ;
                      Ctl        : Integer          ) : TDynaType   ;
    function  ValueSet
               (      Req        : PDynaRequest     ;
                      Ctl        : Integer          ;
                      Value      : PDynaValue       ) : Integer     ;
    function  ValueGet
               (      Req        : PDynaRequest     ;
                      Ctl        : Integer          ;
                      Value      : PDynaValue       ) : Integer     ;
    function  Post
               (      Req        : PDynaRequest     ) : Integer     ;
    procedure Destroy
               (      Req        : PDynaRequest     ) ;
    function  XPanel
               (      Req        : PDynaRequest     ) : PLWXPanel   ;
  end;

  { TDynaMonitorFuncs }

  TDynaMonitorFuncs = class(TGlobal)
  protected
    function GetGlobalType                   : String; override;
  public
    function  Create
              ( const Title   : PChar               ;
                const Caption : PChar               ) : PLWMonitor;
    procedure Destroy
              (      Mon     : PLWMonitor            ) ;
  end;

implementation

{ TDynaReqFuncs }

function TDynaReqFuncs.GetGlobalType: String;
begin
  Result := LWDYNAREQFUNCS_GLOBAL ;
end;

function TDynaReqFuncs.Create
                       ( const Title      : PChar             ) : PDynaRequest;
begin
  Result := PDynaReqFuncs(FGlobal)^.Create(Title);
end;

function TDynaReqFuncs.AddCtrl
                       (       Req        : PDynaRequest ;
                         const Label_     : PChar        ;
                               Descriptor : PDyReqControlDesc ) : Integer;
begin
  Result := PDynaReqFuncs(FGlobal)^.AddCtrl(Req);
end;

function TDynaReqFuncs.CtrlType
                       (       Req        : PDynaRequest ;
                               Ctl        : Integer           ): TDynaType;
begin
  Result := PDynaReqFuncs(FGlobal)^.CtrlType(Req, Ctl);
end;

function TDynaReqFuncs.ValueSet
                       (       Req        : PDynaRequest ;
                               Ctl        : Integer      ;
                               Value      : PDynaValue        ) : Integer;
begin
  Result := PDynaReqFuncs(FGlobal)^.ValueSet(Req, Ctl, Value);
end;

function TDynaReqFuncs.ValueGet
                       (       Req        : PDynaRequest ;
                               Ctl        : Integer      ;
                               Value      : PDynaValue        ) : Integer;
begin
  Result := PDynaReqFuncs(FGlobal)^.ValueGet(Req, Ctl, Value);
end;

function TDynaReqFuncs.Post
                       (       Req        : PDynaRequest      ) : Integer;
begin
  Result := PDynaReqFuncs(FGlobal)^.Post(Req);
end;

procedure TDynaReqFuncs.Destroy
                       (       Req        : PDynaRequest      ) ;
begin
  PDynaReqFuncs(FGlobal)^.Destroy(Req);
end;

function TDynaReqFuncs.XPanel
                       (       Req        : PDynaRequest      ) : PLWXPanel;
begin
  Result := PDynaReqFuncs(FGlobal)^.XPanel(Req);
end;

{ TDynaMonitorFuncs }

function TDynaMonitorFuncs.GetGlobalType: String;
begin
  Result := LWDYNAMONITORFUNCS_GLOBAL ;
end;

function TDynaMonitorFuncs.Create
                           ( const Title   : PChar ;
                             const Caption : PChar            ) : PLWMonitor;
begin
   Result := PDynaMonitorFuncs(FGlobal)^.Create(Title, Caption);
end;

procedure TDynaMonitorFuncs.Destroy
                            (      Mon     : PLWMonitor       ) ;
begin
  PDynaMonitorFuncs(FGlobal)^.Destroy(Mon);
end;

end.

